﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../include/head.jspf"%>   
<title>东方易云后台管理系统</title>
<style>
body { background: #f5f5f5 ;}
</style>
<link rel="stylesheet" href="resource/css/jquery-ui.css" type="text/css"  />
<script type="text/javascript" src="resource/js/jquery-ui.js"></script>
<script>
function addPassChannel(){
	var errorMsg = "";
	errorMsg += sl_checkInteger($("#fiSysSendId")[0], "发送通道编号", 18, 1);
	errorMsg += sl_checkInteger($("#fiSysReceiveId")[0], "接收通道编号", 18, 1);
	var sysRcvIdMsg = $("#sysRcvIdMsg").val();
	if(!isNull(sysRcvIdMsg)){
		alert('<spring:message code="message.norcvdata"/>');
		 return;
	}
	var sysSndIdMsg = $("#sysSndIdMsg").val();
	if(!isNull(sysSndIdMsg)){
		alert('<spring:message code="message.nosnddata"/>');
		 return;
	}
	if(errorMsg != ""){
		alert(errorMsg);
	}else{
		$('#addForm').submit();
	}
}
function renderRcvData(v){
	var dataxChannelBean = getDataByAjax("services/channel/getReceiveChannel",{fiId:v});
	if(dataxChannelBean!=null){
		$("#fcCommunTypeRcv").html(dataxChannelBean.communType);
		$("#fcCommunParamRcv").html(dataxChannelBean.communParam);
		$("#fcMsgFormateIdRcv").html(dataxChannelBean.msgFormate);
		$("#fcMsgCharsetRcv").html(dataxChannelBean.msgCharset);
		$("#fcMsgTypeRcv").html(dataxChannelBean.msgType);
	}else{
		alert('<spring:message code="message.norcvdata"/>');
		$("#fcCommunTypeRcv").html('');
		$("#fcCommunParamRcv").html('');
		$("#fcMsgFormateIdRcv").html('');
		$("#fcMsgCharsetRcv").html('');
		$("#fcMsgTypeRcv").html('');
		$("#fiSysReceiveId").val('');
	}
}
function renderSndData(v){
	var dataxChannelBean = getDataByAjax("services/channel/getSendChannel",{fiId:v});
	if(dataxChannelBean!=null){
		$("#fcCommunTypeSnd").html(dataxChannelBean.communType);
		$("#fcCommunParamSnd").html(dataxChannelBean.communParam);
		$("#fcMsgFormateIdSnd").html(dataxChannelBean.msgFormate);
		$("#fcMsgCharsetSnd").html(dataxChannelBean.msgCharset);
		$("#fcMsgTypeSnd").html(dataxChannelBean.msgType);
	}else{
		alert('<spring:message code="message.nosnddata"/>');
		$("#fcCommunTypeSnd").html('');
		$("#fcCommunParamSnd").html('');
		$("#fcMsgFormateIdSnd").html('');
		$("#fcMsgCharsetSnd").html('');
		$("#fcMsgTypeSnd").html('');
		$("#fiSysSendId").val('');
	}
}

function cancel(){
	$("#addForm")[0].action="passChannel";
	$("#addForm").submit();
}
$(document).ready(function(){
	$("#fiSysSendId").autocomplete({source:"services/channel/getMapSendChannel?fiSysSendId="+encodeURIComponent($(this).val()),
		select: function(e,ui){
			renderSndData(ui.item.value);
		},
		open:function(e,ui){
			$(this).unbind("blur");
		},
		close:function(e,ui){
			$(this).blur(sendBlur);
		}
	});
	
	$("#fiSysReceiveId").autocomplete({source:"services/channel/getMapReceiveChannel?fcChannelDesc="+encodeURIComponent($(this).val()),
		select: function(e,ui){
			renderRcvData(ui.item.value);
		},
		open:function(e,ui){
			$(this).unbind("blur");
		},
		close:function(e,ui){
			$(this).blur(receiveBlur);
		}
	});
	$("#fiSysSendId").blur(sendBlur);
  	$("#fiSysReceiveId").blur(receiveBlur);
});

function sendBlur(){
	var fiSysSend=$("#fiSysSendId").val();
		if(fiSysSend.length>0){
			renderSndData(fiSysSend);
		}else{
			$("#fcCommunTypeSnd").html('');
			$("#fcCommunParamSnd").html('');
			$("#fcMsgFormateIdSnd").html('');
			$("#fcMsgCharsetSnd").html('');
			$("#fcMsgTypeSnd").html('');
			$("#fiSysSendId").val('');
		}
}

function receiveBlur(){
	var fiSysSend=$("#fiSysReceiveId").val();
		if(fiSysSend.length>0){
			renderRcvData(fiSysSend);
		}else{
			$("#fcCommunTypeRcv").html('');
			$("#fcCommunParamRcv").html('');
			$("#fcMsgFormateIdRcv").html('');
			$("#fcMsgCharsetRcv").html('');
			$("#fcMsgTypeRcv").html('');
			$("#fiSysReceiveId").val('');
		}
}
</script>
<!--[if lt IE 7.]>
<script defer type="text/javascript" src="js/pngfix.js"></script>
<![endif]-->
</head>
<body>
<form method="post" action="passChannelAddSubmit" id="addForm">
<input type="hidden" name="pageNoEnterprise" value="<c:out value='${pageNoEnterprise}'/>" />
<input type="hidden" name="pageNoChannel" value="<c:out value='${pageNoChannel}'/>" />
<input type="hidden" name="ecCodeSelect" value="<c:out value='${ecCodeSelect }' />"/>
<input type="hidden" name="fcEntcode" value="<c:out value='${fcEntcode}' />"/>

<div id="body-wrapper">
  <!-- Wrapper for the radial gradient background -->
  <div id="main-content">
    <!-- Main Content Section with everything -->
    <!-- Page Head -->
    <div id="page-title">
    <h3>新建企业传输方式</h3></div>
    <div class="pgline"></div>
    <div class="content-box">
      <!-- Start Content Box -->
      <div class="content-box-header">
        <h3>企业信息</h3>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->
      <div class="content-box-content">
        <div class="tab-content default-tab">
          <table>
            <thead>
              <tr>
                <th>企业编号</th>
                <th>企业名称</th>
                <th>机构代码</th>
                <th>城市</th>
                <th>负责人</th>
                <th>负责人电话</th>
                <th>负责人邮箱</th>
              </tr>
            </thead>
            <tfoot>
              <tr>
                <td colspan="7">
                 </td>
              </tr>
            </tfoot>
            <tbody>
              <tr>
                <td><c:out value="${vwDataxEnterpriseVO.ecCode}"></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.ecName}"></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.orgCode}"></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.city}"></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.name}"></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.officePhone}"></c:out></td>
                <td><c:out value="${vwDataxEnterpriseVO.email}"></c:out></td>
              </tr>
            </tbody>
          </table>
        </div>
        <!-- End #tab1 -->
      </div>
      <!-- End .content-box-content -->
    </div>

    <div style=" border:1px solid #ccc; width:100%; margin:0 0 10px 0;  background-color:#eee">
      <table width="100%" border="1" align="center" cellpadding="1" cellspacing="1">
          <tr>
            <td height="55">&nbsp;&nbsp;&nbsp;&nbsp;服务编码：
              <select name="fcServicecode" id="fcServicecode" class="select1" >
              	<c:forEach items="${optionServeTypeMap}" var="one">
              	<c:choose>
	   				<c:when test="${one.key=='0'}">
	              		<option value="<c:out value="${one.key}" />" selected="selected"><c:out value="${one.value }" /></option>
	            	</c:when>
	   			<c:otherwise><option value="<c:out value="${one.key}" />"><c:out value="${one.value}" /></option></c:otherwise>
	   			</c:choose>
	            </c:forEach>
              </select>
			</td>
          </tr>
      </table>
    </div>
    
    
    <div class="notification querytj png_bg">
      <div>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style=" margin-top:10px; border-bottom:1px dotted #CCC">
          <tr>
            <td width="11%" height="35" align="right"><strong>发送通道编号</strong>： </td>
            <td width="69%" height="35"><input type="text" name="fiSysSendId" id="fiSysSendId" value=""/>
            <td width="20%" height="35"><span id="fiSysSendIdMsg"></span></td>
          </tr>
        </table>
      
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style=" margin-top:10px;border-bottom:2px solid #CCC">
          <tr>
            <td width="12%" height="35" align="right">&nbsp;&nbsp;发送传输方式：              </td>
            <td width="23%"><span id="fcCommunTypeSnd"></span></td>
            <td width="11%"  align="right">发送物理地址：              </td>
            <td width="23%"><span id="fcCommunParamSnd"></span></td>
            <td width="11%" height="35"  align="right">报文格式：</td>
            <td width="20%"><span id="fcMsgFormateIdSnd"></span></td>
          </tr>
          <tr>
            <td height="35"  align="right">&nbsp;&nbsp;报文类型：</td>
            <td height="35"><span id="fcMsgTypeSnd"></span></td>
            <td height="35"  align="right">报文编码：</td>
            <td height="35"><span id="fcMsgCharsetSnd"></span></td>
            <td height="35" colspan="2"> </td>         
          </tr>
        </table>
        
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style=" margin-top:10px; border-bottom:1px dotted #CCC">
          <tr>
            <td width="11%" height="35" align="right"><strong>接收通道编号</strong>： </td>  
            <td width="69%" height="35"><input type="text" name="fiSysReceiveId" id="fiSysReceiveId" value="" ></td>
            <td width="20%" height="35"><span id="fiSysReceiveIdMsg"></span></td>
          </tr>
        </table>
      
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style=" margin-top:10px">
          <tr>
            <td width="12%" height="35" align="right">&nbsp;&nbsp;接收传输方式：              </td>
            <td width="23%"><span id="fcCommunTypeRcv"></span></td>
            <td width="11%"  align="right">接收物理地址：              </td>
            <td width="23%"><span id="fcCommunParamRcv" name="fcCommunParamRcv"></span></td>
            <td width="11%" height="35"  align="right">报文格式：</td>
            <td width="20%"><span id="fcMsgFormateIdRcv"></span></td>
          </tr>
          <tr>
            <td height="35"  align="right">&nbsp;&nbsp;报文类型：</td>
            <td height="35"><span id="fcMsgTypeRcv"></span></td>
            <td height="35"  align="right">报文编码：</td>
            <td height="35"><span id="fcMsgCharsetRcv"></span></td>
            <td height="35" colspan="2"> </td>         
          </tr>
        </table>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style=" margin-top:10px">
          <tr>
            <td height="35" colspan="4" align="right">状态：</td>
            <td width="91%" height="35" colspan="2">
            <c:forEach items="${optionFiFlagMap}" var="one">
	        	<input name="fiFlag" type="radio" style="border-width:0" value="<c:out value="${one.key}" />" <c:out value="${1==one.key?'Checked':''}"/>/><c:out value="${one.value}" />
	        </c:forEach>
	        </td>
          </tr>
          <tr>
            <td height="35" colspan="6" align="center"><div class="line"><a class="button" href="javascript:void(0);" onclick="addPassChannel();">保存</a> &nbsp;&nbsp;<a class="button" href="javascript:void(0)" onclick="cancel()"> 取消</a></td>
          </tr>
        </table>
      </div>
    </div>
      
    </div>
    <div class="clear"></div>
  </div>
  <!-- End #main-content -->
  
</div>
</form>
</body>
</html>
